package com.zy.qudadid.ui.activity;

import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.view.View;
import android.widget.RelativeLayout;

import com.zy.lcpassenger.R;
import com.zy.qudadid.presenter.base.BasePresenterImp;
import com.zy.qudadid.ui.activity.base.ToolBarActivity;
import com.zy.qudadid.utils.ActivityUtil;
import com.zy.qudadid.utils.UserUtil;

import butterknife.Bind;
import butterknife.OnClick;

/**
 * Created by ASUS on 2017/3/6.
 */

public class SettingActivity extends ToolBarActivity {

    @Bind(R.id.rlRule)
    RelativeLayout rlRule;
    @Bind(R.id.rlAboutUs)
    RelativeLayout rlAboutUs;
    @Bind(R.id.rlIntroduce)
    RelativeLayout rlIntroduce;
    @Bind(R.id.rl_quit)
    RelativeLayout rlQuit;
    @Bind(R.id.rlCommonAddress)
    RelativeLayout rlCommonAddress;

    @Override
    protected CharSequence provideTitle() {
        return "设置";
    }

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_setting;
    }

    @Override
    public void initListeners() {

    }

    @Override
    public BasePresenterImp createPresenter() {
        return null;
    }

    @OnClick({R.id.rlRule, R.id.rlAboutUs, R.id.rlIntroduce, R.id.rl_quit, R.id.rlCommonAddress})
    public void onClick(View view) {
        Intent it2 = new Intent();
        switch (view.getId()) {
            case R.id.rlCommonAddress:
                startActivity(ChangyongdizhiActivity.class);
                break;
            case R.id.rlRule:
                it2.putExtra("tag","2");
                it2.setClass(SettingActivity.this, IntroduceEtcActivity.class);
                startActivity(it2);
                break;
            case R.id.rlAboutUs:
                it2.putExtra("tag","3");
                it2.setClass(SettingActivity.this, IntroduceEtcActivity.class);
                startActivity(it2);
                break;
            case R.id.rlIntroduce:
                it2.putExtra("tag","4");
                it2.setClass(SettingActivity.this, IntroduceEtcActivity.class);
                startActivity(it2);
                break;
            case R.id.rl_quit:
                AlertDialog.Builder builder = new AlertDialog.Builder(this);
                builder.setTitle("提示").setMessage("您确定退出登录？").setNegativeButton("取消", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        dialog.dismiss();
                    }
                }).setPositiveButton("确定", new DialogInterface.OnClickListener() {
                    public void onClick(DialogInterface dialog, int which) {
                        new UserUtil(SettingActivity.this).removeUserInfo();
                        startActivity(LoginActivity.class);
                       // finish();
                        ActivityUtil.addActivity(SettingActivity.this);
                        ActivityUtil.finishActivitys();
                    }
                }).setOnCancelListener(new DialogInterface.OnCancelListener() {
                    public void onCancel(DialogInterface dialog) {
                        dialog.dismiss();
                    }
                }).show();
                break;
        }
    }



}
